

import org.json.JSONException;
import org.json.JSONObject;

public class LotteryOrder {
	private String pid = "";
	private String order_id = "";
	private String type;
	private String[] style;
	private String orgstyle;
	private String sn; //彩券期號
	private String[] numbers;
	private String orgnumbers;
	private String[] spcl_num;
	private String orgspcl_num;
	private String[] multiple;
	private String orgmultiple;
	private String[] remark;
	private String orgremark;
	private String amount = "";
	private String money = "";
	private String imgname = "";
	private String imgurl = "";
	private int lottery_unit_number = 0;
	private String imgorderurl = "";
	private boolean status = false;
	private String doub = "";
	private int ticketaccount = 1;
	
	public LotteryOrder(JSONObject jo) {
		try {
			pid = jo.getString("pid");		
			order_id = jo.getString("order_id");
			type = jo.getString("type");
			style = jo.getString("style").split(";");
			orgstyle = jo.getString("style");
			sn = jo.getString("sn");
			numbers = jo.getString("numbers").replace(",", "-").split(";");
			orgnumbers = jo.getString("numbers");
			spcl_num = jo.getString("spcl_num").split(";");
			orgspcl_num = jo.getString("spcl_num");
			multiple = jo.getString("multiple").split(";");
			orgmultiple = jo.getString("multiple");
			remark = jo.getString("remark").split(";");
			orgremark = jo.getString("remark");
			amount = jo.getString("amount");
			money = jo.getString("money");
			doub = jo.getString("doub");
		} catch (JSONException e) {

		}
	}
	
	public void setTicketCount(int count){
		this.ticketaccount = count;
	}
	
	public int getTicketCount(){
		return ticketaccount;
	}
	
	public String getDoub(){
		return doub;
	}
	
	public void setUnit_Number(int unit_number){
		this.lottery_unit_number = unit_number;
	}
	
	public int getUnit_Number(){
		return lottery_unit_number;
	}
	
	public String getOrgStyle(){
		return orgstyle;
	}
	public String getOrgNumbers(){
		return orgnumbers;
	}
	public void setOrgNumbers(String nums){
		this.orgnumbers = nums;
	}
	public String getOrgSpcl_num(){
		return orgspcl_num;
	}
	public void setOrgSpcl_num(String spcl_num){
		this.orgspcl_num = spcl_num;
	}
	public String getOrgMultiple(){
		return orgmultiple;
	}
	public String getOrgRemark(){
		return orgremark;
	}
	
	public void setImageURL(String url){
		this.imgurl = url;
	}
	
	public String getImageURL(){
		return imgurl;
	}
	
	public void setImgOrderURL(String url){
		this.imgorderurl = url;
	}
	
	public String getImgOrderURL(){
		return imgorderurl;
	}
	
	public void setImageName(String name){
		this.imgname = name;
	}
	
	public String getImageName(){
		return imgname;
	}
	
	public void setGetStatus(boolean status){
		this.status = status;
	}
	
	public boolean isGetBuyOK(){
		return status;
	}
	
	public String getMoney(){
		return money;
	}
	
	public String getSn(){
		return sn;
	}
	
	public String[] getNumbers(){
		return numbers;
	}
	
	public String[] getSpecial_num(){
		return spcl_num;
	}
	
	public String[] getMultiple(){
		return multiple;
	}
	
	public String[] getRemark(){
		return remark;
	}
	
	public String getAmount(){
		return amount;
	}
	
	public String getPID(){
		return pid;
	}
	
	public String getOrder_id(){
		return order_id;
	}
	
	public void setOrder_id(String order_id){
		this.order_id = order_id;
	}
	
	public String getType(){
		return type;
	}
	
	/**
	 *  威力彩	1
		大樂透	2
		今彩539	3
		Bingo Bingo	4
		樂線九宮格	5
		3星彩	6
		4星彩	7
		38樂合彩	8
		49樂合彩	9
		39樂合彩	10
	 * @return
	 */
	public String getTypeStr(){
		int t;
		try{
			t = Integer.parseInt(type.replace("'", ""));
		}catch(Exception e){
			return "";
		}
		switch(t){
		case 1:
			return "威力彩";
		case 2:
			return "大樂透";
		case 3:
			return "今彩539";
		case 4:
			return "Bingo Bingo";
		case 5:
			return "樂線九宮格";
		case 6:
			return "3星彩";
		case 7:
			return "4星彩";
		case 8:
			return "38樂合彩";
		case 9:
			return "49樂合彩";
		case 10:
			return "39樂合彩";
		default:
			return "";
		}
	}
	
	public String getLoType(String type){
		int t = 0;
		try{
			t = Integer.parseInt(type);
		}catch(Exception e){
			t = 0;
		}
		return getLoType(t);
	}
	
	public String getLoType(int type){
		switch(type){
		case 1:
			return "superlotto638";
		case 2:
			return "lotto649";
		case 3:
			return "dailycash";
		case 4:
			return "Bingo Bingo";
		case 5:
			return "ttt";
		case 6:
			return "3d";
		case 7:
			return "4d";
		case 8:
			return "38m6";
		case 9:
			return "49m6";
		case 10:
			return "39m5";
		default:
			return "";
		}
	}
	
	public String[] getStyle(){
		return style;
	}
	
	/**
	 *  無	0
		自選	1
		快選	2
		部快	3
		配號	4
		系統	5
		超級獎號	6
	 * @return
	 */
	public String getStyleStr(int offset){
		int t;
		try{
			t = Integer.parseInt(style[offset].replace("'", ""));
		}catch(Exception e){
			return "";
		}
		switch(t){
		case 1:
			return "自選";
		case 2:
			return "快選";
		case 3:
			return "部快";
		case 4:
			return "配號";
		case 5:
			return "系統";
		case 6:
			return "超級獎號";
		default:
			return "";
		}
	}


}
